package controlLayer;

import modelLayer.PersonContainer;
import modelLayer.Person;
/**
 * Write a description of class PersonCtr here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class PersonCtr
{
    // instance variables - replace the example below with your own
    private PersonContainer personCon;

    /**
     * Constructor for objects of class PersonCtr
     */
    public PersonCtr()
    {
        // initialise instance variables
        // Singleton initialization
        personCon = PersonContainer.getInstance();
    }
    
    // Create a person
    public void createPerson(String cpr, String name, String address, String postalCode, String city, String phone)
    {
        Person person = new Person(cpr,name,address,postalCode,city,phone);
        personCon.addPerson(person);
    }
    
    // Find a person
    public Person findPerson(String cpr)
    {
        return personCon.getPerson(cpr);
    }
    
    // Update a person
    public void updatePerson(Person person, String cpr, String name, String address, String postalCode, String city, String phone)
    {
        person.setCpr(cpr);
        person.setName(name);
        person.setAddress(address);
        person.setPostalCode(postalCode);
        person.setCity(city);
        person.setPhone(phone);
    }
    
    // Delete a person
    public void deletePerson(Person person)
    {
        personCon.deletePerson(person);
    }

    
    
    
    

}
